package com.rran.study.designpattern.behavioral.observer.listener.app;

import com.rran.study.designpattern.behavioral.observer.event.app.SmokeEvent;
import com.rran.study.designpattern.behavioral.observer.model.Smoke;

/**
 * @author yy
 * @Type AppPayListener.java
 * @Desc SmokeEvent监听者--抽烟者的朋友
 * @date 2020/7/21 19:42
 */
public class AppFriendListener implements AppListener<SmokeEvent> {
    @Override
    public void applicationEvent(SmokeEvent event) {
        this.share(event.getSource());
    }

    /**
     * 拿烟
     */
    private void share(Smoke smoke) {
        System.out.println("观察者朋友：给我" + smoke.getNumber() / 2 + "根");
    }

}
